package com.example.sunjian.myapplication.event_dispatch;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;

/**
 * 作者：sunjian on 16/6/6 17:39
 * 邮箱：sunjian@cyhz.com
 */
public class CustomView extends View {


    public CustomView(Context context) {
        super(context);
    }

    public CustomView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CustomView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }


    @Override
    public boolean dispatchTouchEvent(MotionEvent event) {
        return super.dispatchTouchEvent(event);
    }

    /**
     * @param event
     * @return
     */
    @Override
    public boolean onTouchEvent(MotionEvent event) {
        switch (event.getAction()){

            case MotionEvent.ACTION_DOWN:

                Log.e("sj","view  onTouchEvent  ACTION_DOWN");

                break;

            case MotionEvent.ACTION_MOVE:

                Log.e("sj","view  onTouchEvent  ACTION_MOVE");

                break;

            case MotionEvent.ACTION_UP:

                Log.e("sj","view  onTouchEvent  ACTION_UP");

                break;
        }

        return super.onTouchEvent(event);
    }

}
